<?php
/**
 * 招车申请
 *
 */

namespace dragon\Taxi;

use think\Model;

class TaxiCall extends Model {
    protected $autoWriteTimestamp = true;

    public function save($data = [], $where = [], $sequence = null)
    {
        if(isset($data['status'])) {
            if($data['status'] == 3) {
                $data['finished_time'] = time();
                message($this->user_id, '招车订单 - '.$this->order_no.' 已完成', '招车订单 - '.$this->order_no.' 已完成, 感谢您的使用');
            }elseif ($data['status'] == 2){
                $data['dispatch_time'] = time();
                message($this->user_id, '招车订单 - '.$this->order_no.' 已派单', '招车订单 - '.$this->order_no.' 已派单, 车牌号：'.$data['driver_name'].'， 祝您行程愉快');
            }elseif ($data['status'] == 0){
                message($this->user_id, '招车订单 - '.$this->order_no.' 已取消', '招车订单 - '.$this->order_no.' 已取消, 感谢您的使用');
            }
        }
        return parent::save($data, $where, $sequence); // TODO: Change the autogenerated stub
    }
}